<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:fn="http://java.sun.com/jsp/jstl/functions"
   template="/WEB-INF/templates/default.xhtml">
   <ui:define name="content">

		<f:metadata>
			<f:viewParam name="result" value="#{productListService.firstResult}" />
		</f:metadata>


		<ui:repeat var="product" value="#{productListService.resultList}">
			<div style="padding-bottom: 10px;">
				<h2>#{product.title} (#{product.barcode})</h2>

					<div style="color: #AAAAAA; font-size: smaller;">
					#{product.author.firstname}, #{product.author.surname}
					-
					<h:outputText value="#{product.created}">
						<f:convertDateTime pattern="dd-MM-yyyy" />
					</h:outputText>
				</div>
			</div>

			<div style="clear:both;">#{product.shortContent}</div>

			<div style="padding-bottom: 10px; margin: 10px 0px 30px 0px; border-bottom: 1px solid; border-color: #AAAAAA;">
				<h:link outcome="view" value="Read more &#187;">
					<f:param name="id" value="#{product.id}"/>
				</h:link>
			</div>
		</ui:repeat>

		<div>
	        <h:link style="float:left;" rendered="#{productListService.previousExists}" value="&#171; Previous Page">
	            <f:param name="result" value="#{productListService.previousFirstResult}"/>
	        </h:link>

	        <h:link style="float:right;"  rendered="#{productListService.nextExists}" value="Next Page  &#187;">
	            <f:param name="result" value="#{productListService.nextFirstResult}"/>
	        </h:link>
		</div>


   </ui:define>
</ui:composition>
